#!/usr/bin/python

def n_points(f):
	s= open(f, "r")
	return len(s.readlines())	

header= """file = %file
points = %points
format = ascii
interleaving = field
field = locations, field0
structure = 2-vector, scalar
type = float, float

end"""

from sys import *
print argv[1:]
test_cases= argv[1:] 
for f in test_cases:
	points= n_points(f)
	s_out= open(f.replace(".out",".general"), "w")
	s_out.write(header.replace("%file", f).replace("%points", str(points)))
	s_out.close()

